home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 February / OpenLinux 2.3 CD.iso / live / usr / lib / rpm-2.5.5 / find-requires < prev    next >
Encoding:
Text File  |  1999-08-10  |  835 b   |  28 lines

  1. #!/bin/sh
  2.  
  3. # note this works for both a.out and ELF executables
  4. # it also auto-generates requirment lines for shell scripts
  5.  
  6. ulimit -c 0
  7.  
  8. filelist=`sed "s/['\"]/\\\&/g"`
  9. exelist=`echo $filelist | xargs -r file | fgrep executable | cut -d: -f1 `
  10. scriptlist=`echo $filelist | xargs -r file | egrep ":.* (commands|script) " | cut -d: -f1 `
  11. liblist=`echo $filelist | xargs -r file | grep "shared object" | cut -d : -f1 `
  12.  
  13. for f in $exelist; do
  14.     if [ -x $f ]; then
  15.     ldd $f | awk '/=>/ { print $1 }'
  16.     fi
  17. done | sort -u | sed "s/['\"]/\\\&/g" | xargs -r -n 1 basename | sort -u
  18.  
  19. for f in $liblist; do
  20.     ldd $f | awk '/=>/ { print $1 }'
  21. done | sort -u | sed "s/['\"]/\\\&/g" | xargs -r -n 1 basename | sort -u
  22.  
  23. for f in $scriptlist; do
  24.     if [ -x $f ]; then
  25.     head -1 $f | sed -e 's/^\#\![     ]*//' | cut -d" " -f1
  26.     fi
  27. done | sort -u
  28.